﻿package problems.diningphilosophers.philosopherssolution;

import problems.BenchmarkSemaphore;
import problems.diningphilosophers.philosophers.*;

public class DiningPhilosophersWithLeftHandedRightHandedSolution extends AbstractDiningPhilosophersSolution
{
    private boolean returnLefty;
    public DiningPhilosophersWithLeftHandedRightHandedSolution(int nbPhilosophers) {
    	super(nbPhilosophers);
    }
    
    @Override
    protected AbstractPhilosopher createPhilosopher(BenchmarkSemaphore leftFork, BenchmarkSemaphore rightFork)
    {
        returnLefty = !returnLefty;
        if (returnLefty) return new LeftHandedPhilosopher(leftFork, rightFork);
        else return new RightHandedPhilosopher(leftFork, rightFork);
    }
}